<template>
  <div class="about">
    <h1>{{msg}}</h1>
    <button @click="changemsg">{{ btnName }}</button>
  </div>
</template>
<script>
import { defineComponent, ref } from "vue";
export default {
  props: ["btnName"],
  setup(props, { emit }) {
    const msg = ref("你好, vue3.0");
    const changemsg = () => {
      msg.value = "这是全新的vue.js";
      emit("changeMsg", "我是通过子组件调用的父组件的方法传过来的值");
    };

    return {
      msg,
      changemsg
    };
  }
};
</script>